Global Variables
Generally contains functions that were modified to do something different.
Functions
print
print( ... )
Prints text to the chat. Will be always converted to a string so you can pass in anything.
If it is a table. It will convert to be printable and you can see the contents inside.
Arguments:
- ... [ any[] ] All arguments to send to the chat.
alert
alert( message, duration, player )
Same as the print function but sends it as a alert message.
Sending alert messages to a specific player requires unsafe-env!
Arguments:
- message [ any[] ] The message to send
- duration [ any[] ] The duration before the alert message fades-out
- player [ Player? ] The player to send to.
loadstring
loadstring( code, env, bytecodeMode )
Excecutes code from a string, it can also load bytecode!
Loading bytecode only works in the unsafe env!
Arguments:
- code [ string ] The code to excecute.
- env [ table ] The code environment.
- bytecodeMode [ boolean ] Whether you are trying to excecute bytecode or not.
tostring
tostring( data )
Like the normal but modified to have additional features like printing lua tables!
Arguments:
- data [ any ] The variable to convert to be a string.
debug
debug( ... )
The debug function is basically Lua's implementation of the print
function in Scrap Mechanic.
Arguments:
- ... [ any[] ] All arguments to send to the console.
sleep
sleep( time )
Makes the code pause for the specified time at that particular place, maximum wait is 5 seconds.
Arguments:
- time [ number ] The time to sleep in seconds.